package com.spsoft.vatoutinv.service.vmsnvattrandtadvaltax.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.spsoft.core.enums.ResponseEnum;
import com.spsoft.core.exception.BusinessException;
import com.spsoft.system.entity.NvatRevenuemapself;
import com.spsoft.vatoutinv.mapper.VmsNvatRevenuemapselfMapper;
import com.spsoft.vatoutinv.service.vmsnvattrandtadvaltax.VmsNvatRevenuemapselfService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author wangy
 * @date 2024/6/21 15:34
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class VmsNvatRevenuemapselfServiceImpl extends ServiceImpl<VmsNvatRevenuemapselfMapper, NvatRevenuemapself> implements VmsNvatRevenuemapselfService {


    @Override
    public NvatRevenuemapself getRevenuemapselfByXrdid(String id) {
        // 1. 先查询出该条流水
        NvatRevenuemapself one = getOne(new LambdaQueryWrapper<NvatRevenuemapself>()
                .eq(NvatRevenuemapself::getXrdid, id),false
        );
        // 1.1 判断是否为空
        if (one == null) {
            throw new BusinessException(ResponseEnum.TRANSACTION_FLOW_INFORMATION_DOES_NOT_EXIST);
        }
        return one;
    }
}
